home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / WarpQuake / Src / vid_amiga.c < prev    next >
C/C++ Source or Header  |  2000-05-22  |  16KB  |  637 lines

  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3.  
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  12.  
  13. See the GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. */
  20. // vid_amiga.c -- amiga video driver
  21.  
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <signal.h>
  25.  
  26. #include <exec/exec.h>
  27. #include <graphics/gfx.h>
  28. #include <intuition/intuition.h>
  29. #include <libraries/asl.h>
  30. #include <utility/tagitem.h>
  31. #include <clib/chunkyppc_protos.h>
  32. #include <powerup/ppcproto/exec.h>
  33. #include <powerup/ppcproto/graphics.h>
  34. #include <powerup/ppcproto/intuition.h>
  35. #include <powerup/ppcproto/asl.h>
  36.  
  37. #include "quakedef.h"
  38. #include "d_local.h"
  39.  
  40. extern void ppc_c2p_line (int line, int src, struct BitMap *dst, int cnt);
  41.  
  42. static qboolean using_mouse = false;
  43. extern short int last_mouse[2];
  44. qboolean mousemove = false;
  45. static qboolean force = false;
  46. static qboolean wpa8 = false;
  47.  
  48. #define    BASEWIDTH    320
  49. #define    BASEHEIGHT    200
  50.  
  51. pixel_t *vid_buffer;
  52. short *zbuffer;
  53. byte *surfcache;
  54.  
  55. unsigned short    d_8to16table[256];
  56.  
  57. /**********************************************************************/
  58.  
  59. struct GfxBase *GfxBase = NULL;
  60. struct IntuitionBase *IntuitionBase = NULL;
  61. struct Library *ChunkyPPCBase = NULL;
  62. struct Library *AslBase = NULL;
  63.  
  64. static struct Mode_Screen ms;
  65. struct Mode_Screen *msptr = &ms;
  66. static struct Screen *video_screen = NULL;
  67. static struct Window *video_window = NULL;
  68. static struct ScreenModeRequester *smr = NULL;
  69. static struct RastPort rp;
  70. static struct RastPort temprp;
  71. static struct BitMap *next_bm;
  72. static unsigned char *next_sbuf;
  73. static struct BitMap tmp_bm = {
  74.   0, 0, 0, 0, 0, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
  75. };
  76.  
  77. static UWORD *emptypointer = NULL;
  78. static BOOL is_cyber_mode = FALSE;
  79. static BOOL is_native_mode = FALSE;
  80.  
  81. /**********************************************************************/
  82. void    VID_SetPalette (unsigned char *palette)
  83. {
  84.   int i;
  85.   ULONG v;
  86.   static ULONG colourtable[1+3*256+1];
  87.  
  88.   colourtable[0] = (256 << 16) + 0;
  89.   for (i = 0; i < 3*256; i++) {
  90.     v = *palette++;
  91.     v += (v << 8);
  92.     v += (v << 16);
  93.     colourtable[i+1] = v;
  94.   }
  95.   colourtable[1 + 3*256] = 0;
  96.     if (wpa8)
  97.         LoadRGB32 (&video_screen->ViewPort, colourtable);
  98.     else
  99.       LoadColors (&ms, colourtable);
  100. }
  101.  
  102. /**********************************************************************/
  103. void    VID_ShiftPalette (unsigned char *palette)
  104. {
  105.   VID_SetPalette (palette);
  106. }
  107.  
  108. /****************************************************************************/
  109. void    VID_Init (unsigned char *palette)
  110. {
  111.   int mode, d;
  112.     int width = 0, height = 0;
  113.     int w, h;
  114.     ULONG idcmp, flags, propertymask;
  115.     struct TagItem stags[7];
  116.     struct TagItem wtags[8];
  117.     struct TagItem atags[12];
  118.  
  119.     force = COM_CheckParm ("-force");
  120.     wpa8 = COM_CheckParm ("-wpa8");
  121.     using_mouse = COM_CheckParm ("-mouse");
  122.  
  123.     (struct Library *)GfxBase = OpenLibrary("graphics.library", 39);
  124.     (struct Library *)IntuitionBase = OpenLibrary("intuition.library", 39);
  125.     AslBase = OpenLibrary("asl.library", 38);
  126.  
  127.     if (GfxBase == NULL)
  128.         Sys_Error ("OpenLibrary(""graphics.library"", 39) failed");
  129.     if (IntuitionBase == NULL)
  130.         Sys_Error ("OpenLibrary(""intuition.library"", 39) failed");
  131.     if (AslBase == NULL)
  132.         Sys_Error ("OpenLibrary(""asl.library"", 38) failed");
  133.  
  134.     if (!wpa8)
  135.     {
  136.         if ((ChunkyPPCBase = OpenLibrary("chunkyppc.library", 3)) == NULL)
  137.             Sys_Error ("OpenLibrary(""chunkyppc.library"", 3) failed");
  138.     }
  139.  
  140.     if (wpa8)
  141.     {
  142.         if ((smr = AllocAslRequest (ASL_ScreenModeRequest, NULL)) == NULL)
  143.             Sys_Error ("AllocAslRequest() failed");
  144.  
  145.  
  146.         propertymask = DIPF_IS_EXTRAHALFBRITE | DIPF_IS_DUALPF | DIPF_IS_PF2PRI |
  147.                                      DIPF_IS_HAM;
  148.  
  149.         atags[0].ti_Tag = ASLSM_TitleText;
  150.         atags[0].ti_Data = (ULONG)"WarpQuake";
  151.         atags[1].ti_Tag = ASLSM_MinWidth;
  152.         atags[1].ti_Data = BASEWIDTH;
  153.         atags[2].ti_Tag = ASLSM_MinHeight;
  154.         atags[2].ti_Data = BASEHEIGHT;
  155.         atags[3].ti_Tag = ASLSM_InitialDisplayWidth;
  156.         atags[3].ti_Data = BASEWIDTH;
  157.         atags[4].ti_Tag = ASLSM_InitialDisplayHeight;
  158.         atags[4].ti_Data = BASEHEIGHT;
  159.         atags[5].ti_Tag = ASLSM_MinDepth;
  160.         atags[5].ti_Data = 8;
  161.         atags[6].ti_Tag = ASLSM_MaxDepth;
  162.         atags[6].ti_Data = 8;
  163.         atags[7].ti_Tag = ASLSM_DoWidth;
  164.         atags[7].ti_Data = TRUE;
  165.         atags[8].ti_Tag = ASLSM_DoHeight;
  166.         atags[8].ti_Data = TRUE;
  167.         atags[9].ti_Tag = ASLSM_PropertyMask;
  168.         atags[9].ti_Data = propertymask;
  169.         atags[10].ti_Tag = ASLSM_PropertyFlags;
  170.         atags[10].ti_Data = 0;
  171.         atags[11].ti_Tag = TAG_DONE;
  172.         atags[11].ti_Data = 0;
  173.  
  174.         if((AslRequest (smr, atags)) == NULL)
  175.             Sys_Error ("AslRequest() failed");
  176.  
  177.         mode = smr->sm_DisplayID;
  178.         width = smr->sm_DisplayWidth;
  179.         height = smr->sm_DisplayHeight;
  180.  
  181.         stags[0].ti_Tag = SA_Type;
  182.         stags[0].ti_Data = CUSTOMSCREEN;
  183.         stags[1].ti_Tag = SA_DisplayID;
  184.         stags[1].ti_Data = mode;
  185.         stags[2].ti_Tag = SA_Width;
  186.         stags[2].ti_Data = width;
  187.         stags[3].ti_Tag = SA_Height;
  188.         stags[3].ti_Data = height;
  189.         stags[4].ti_Tag = SA_Depth;
  190.         stags[4].ti_Data = 8;
  191.         stags[5].ti_Tag = SA_Quiet;
  192.         stags[5].ti_Data = TRUE;
  193.         stags[6].ti_Tag = TAG_END;
  194.         stags[6].ti_Data = 0;
  195.  
  196.         if((video_screen = OpenScreenTagList (NULL, stags)) == NULL)
  197.             Sys_Error ("OpenScreenTagList() failed\n");
  198.  
  199.         idcmp = IDCMP_RAWKEY;
  200.         flags = WFLG_ACTIVATE | WFLG_BORDERLESS | WFLG_NOCAREREFRESH |
  201.               WFLG_SIMPLE_REFRESH;
  202.       if (using_mouse)
  203.         {
  204.         idcmp |= IDCMP_MOUSEBUTTONS | IDCMP_DELTAMOVE | IDCMP_MOUSEMOVE;
  205.         flags |= WFLG_RMBTRAP | WFLG_REPORTMOUSE;
  206.       }
  207.  
  208.         wtags[0].ti_Tag = WA_Left;
  209.         wtags[0].ti_Data = 0;
  210.         wtags[1].ti_Tag = WA_Top;
  211.         wtags[1].ti_Data = 0;
  212.         wtags[2].ti_Tag = WA_Width;
  213.         wtags[2].ti_Data = width;
  214.         wtags[3].ti_Tag = WA_Height;
  215.         wtags[3].ti_Data = height;
  216.         wtags[4].ti_Tag = WA_IDCMP;
  217.         wtags[4].ti_Data = idcmp;
  218.         wtags[5].ti_Tag = WA_Flags;
  219.         wtags[5].ti_Data = flags;
  220.         wtags[6].ti_Tag = WA_CustomScreen;
  221.         wtags[6].ti_Data = (ULONG) video_screen;
  222.         wtags[7].ti_Tag = TAG_DONE;
  223.         wtags[7].ti_Data = 0;
  224.  
  225.         if((video_window = OpenWindowTagList (NULL, wtags)) == NULL)
  226.             Sys_Error ("OpenWindowTagList() failed\n");
  227.  
  228.         if ((emptypointer = AllocVec (16, MEMF_CHIP | MEMF_CLEAR)) == NULL)
  229.             Sys_Error ("Couldn't allocate chip memory for pointer");
  230.         SetPointer (video_window, emptypointer, 1, 16, 0, 0);
  231.  
  232.         InitRastPort (&rp);
  233.         rp.BitMap = video_screen->ViewPort.RasInfo->BitMap;
  234.  
  235.         InitBitMap (&tmp_bm, 8, width, 1);
  236.         for (d = 0; d < 8; d++)
  237.             if ((tmp_bm.Planes[d] = (PLANEPTR)AllocRaster (width, 1)) == NULL)
  238.                 Sys_Error ("AllocRaster() failed");
  239.         temprp = *video_window->RPort;
  240.         temprp.Layer = NULL;
  241.         temprp.BitMap = &tmp_bm;
  242.     }
  243.     else
  244.     {
  245.         w = COM_CheckParm ("-width");
  246.         if (w)
  247.         {
  248.             if (w < com_argc-1)
  249.                 ms.SCREENWIDTH = Q_atoi (com_argv[w+1]);
  250.             else
  251.                 Sys_Error ("You must specify a size after -width");
  252.         }
  253.         else
  254.             ms.SCREENWIDTH = BASEWIDTH;
  255.  
  256.         h = COM_CheckParm ("-height");
  257.         if (h)
  258.         {
  259.             if (h < com_argc-1)
  260.                 ms.SCREENHEIGHT = Q_atoi (com_argv[h+1]);
  261.             else
  262.                 Sys_Error ("You must specify a size after -height");
  263.         }
  264.         else
  265.             ms.SCREENHEIGHT = BASEHEIGHT;
  266.  
  267.         ms.MS_MAXWIDTH = 1280;
  268.         ms.MS_MAXHEIGHT = 1024;
  269.         ms.MAXDEPTH = 8;
  270.         ms.MINDEPTH = 8;
  271.         ms.video_screen = 0;
  272.         ms.video_window = 0;
  273.  
  274.         if (force)
  275.             msptr = OpenGraphics ("WarpQuake", &ms, 1);
  276.         else
  277.             msptr = OpenGraphics ("WarpQuake", &ms, 0);
  278.  
  279.         if (!msptr)
  280.             Sys_Error ("OpenGraphics() failed\n");
  281.  
  282.         if (!(ChunkyInit(&ms,PIXFMT_LUT8)))
  283.             Sys_Error ("ChunkyInit() failed\n");
  284.  
  285.         if (ms.video_is_native_mode)
  286.         {
  287.             is_native_mode = TRUE;
  288.             InitRastPort (&rp);
  289.             rp.BitMap = ms.video_screen->ViewPort.RasInfo->BitMap;
  290.             if (ms.numbuffers == 1)
  291.                 next_bm = ms.bitmapa;
  292.             else
  293.                 next_bm = ms.bitmapb;
  294.         }
  295.         else
  296.         {
  297.             if (ms.video_is_cyber_mode)
  298.                 is_cyber_mode = TRUE;
  299.  
  300.             if (ms.numbuffers == 1)
  301.                 next_sbuf = ms.screen;
  302.             else
  303.                 next_sbuf = ms.screenb;
  304.         }
  305.  
  306.       mode = ms.mode;
  307.       width = ms.SCREENWIDTH;
  308.       height = ms.SCREENHEIGHT;
  309.         video_window = ms.video_window;
  310.  
  311.       Con_Printf ("Screen Mode $%08x is", mode);
  312.       if (is_native_mode)
  313.         Con_Printf (" NATIVE-PLANAR");
  314.       else
  315.         Con_Printf (" FOREIGN");
  316.       Con_Printf (" 8-BIT");
  317.       if (is_cyber_mode)
  318.         Con_Printf (" CYBERGRAPHX");
  319.       Con_Printf (", using size %d x %d\n", width, height);
  320.  
  321.         if (!using_mouse)
  322.         {
  323.             if(!(ModifyIDCMP(ms.video_window, IDCMP_RAWKEY)))
  324.                 Sys_Error ("ModifyIDCMP() failed\n");
  325.         }
  326.     }
  327.  
  328.   if ((vid_buffer = (pixel_t *)malloc(sizeof(pixel_t) *
  329.                                       width * height)) == NULL ||
  330.       (zbuffer = (short *)malloc(sizeof(short) * width * height)) == NULL ||
  331.       (surfcache = (byte *)malloc(sizeof(byte) *
  332.                                   (width*height/(320*200))*256*1024*3)) == NULL)
  333.             Sys_Error ("Out of memory");
  334.  
  335.   vid.width = vid.conwidth = width;
  336.   vid.height = vid.conheight = height;
  337.   vid.maxwarpwidth = WARP_WIDTH;
  338.   vid.maxwarpheight = WARP_HEIGHT;
  339.  
  340.     if (COM_CheckParm ("-noaspectadjust"))
  341.         vid.aspect = 1.0;
  342.     else
  343.       vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0);
  344.  
  345.     if (wpa8)
  346.         vid.numpages = 1;
  347.     else
  348.       vid.numpages = ms.numbuffers;
  349.  
  350.   vid.colormap = host_colormap;
  351.   vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048));
  352.   vid.buffer = vid.conbuffer = vid_buffer;
  353.   vid.rowbytes = vid.conrowbytes = width;
  354.   vid.direct = NULL;
  355.  
  356.   d_pzbuffer = zbuffer;
  357.   D_InitCaches (surfcache, sizeof(byte) *
  358.                            (width*height/(320*200))*256*1024*3);
  359.  
  360.   VID_SetPalette (palette);
  361.  
  362. }
  363.  
  364. /**********************************************************************/
  365. void    VID_Shutdown (void)
  366. {
  367.     int d;
  368.  
  369.   if (surfcache != NULL)
  370.     {
  371.     free (surfcache);
  372.     surfcache = NULL;
  373.   }
  374.  
  375.   if (zbuffer != NULL)
  376.     {
  377.     free (zbuffer);
  378.     zbuffer = NULL;
  379.   }
  380.  
  381.   if (vid_buffer != NULL)
  382.     {
  383.     free (vid_buffer);
  384.     vid_buffer = NULL;
  385.   }
  386.  
  387.     for (d = 0; d < 8; d++)
  388.     {
  389.       if (tmp_bm.Planes[d] != NULL)
  390.         {
  391.         FreeRaster (tmp_bm.Planes[d], vid.width, 1);
  392.             tmp_bm.Planes[d] = NULL;
  393.         }
  394.     }
  395.  
  396.     if (wpa8)
  397.     {
  398.         if (video_window != NULL)
  399.         {
  400.             ClearPointer (video_window);
  401.             CloseWindow (video_window);
  402.             video_window = NULL;
  403.         }
  404.     }
  405.  
  406.     if (emptypointer != NULL)
  407.     {
  408.         FreeVec (emptypointer);
  409.         emptypointer = NULL;
  410.     }
  411.  
  412.     if (video_screen != NULL)
  413.     {
  414.         CloseScreen (video_screen);
  415.         video_screen = NULL;
  416.     }
  417.  
  418.     if (smr != NULL)
  419.     {
  420.         FreeAslRequest (smr);
  421.         smr = NULL;
  422.     }
  423.  
  424.  
  425.     if (msptr != NULL)
  426.     {
  427.         CloseGraphics (msptr, 1);
  428.         msptr = NULL;
  429.     }
  430.  
  431.     if (ChunkyPPCBase != NULL)
  432.     {
  433.         CloseLibrary (ChunkyPPCBase);
  434.         ChunkyPPCBase = NULL;
  435.     }
  436.  
  437.     if (AslBase != NULL)
  438.     {
  439.         CloseLibrary (AslBase);
  440.         AslBase = NULL;
  441.     }
  442.  
  443.     if (IntuitionBase != NULL)
  444.     {
  445.         CloseLibrary ((struct Library *)IntuitionBase);
  446.         IntuitionBase = NULL;
  447.     }
  448.  
  449.     if (GfxBase != NULL)
  450.     {
  451.         CloseLibrary ((struct Library *)GfxBase);
  452.         GfxBase = NULL;
  453.     }
  454. }
  455.  
  456. /**********************************************************************/
  457. void    VID_Update (vrect_t *rects)
  458. {
  459.     APTR handle;
  460.  
  461.     if (cls.timedemo2)
  462.         return;
  463.  
  464.     if (is_native_mode)
  465.     {
  466.         int i, j;
  467.         while (rects != NULL)
  468.         {
  469.             for (i = rects->y, j = ((int)(vid_buffer)) + rects->y * vid.width;
  470.                                       i < rects->y + rects->height; i++, j += vid.width)
  471.         ppc_c2p_line (i, j, rp.BitMap, (vid.width + 31) >> 5);
  472.             rects = rects->pnext;
  473.         }
  474.         if (ms.numbuffers == 2)
  475.         {
  476.             if (next_bm == ms.bitmapa)
  477.                 next_bm = ms.bitmapb;
  478.             else
  479.                 next_bm = ms.bitmapa;
  480.         }
  481.         else if (ms.numbuffers == 3)
  482.         {
  483.             if (next_bm == ms.bitmapa)
  484.                 next_bm = ms.bitmapb;
  485.             else if (next_bm == ms.bitmapb)
  486.                 next_bm = ms.bitmapc;
  487.             else
  488.                 next_bm = ms.bitmapa;
  489.         }
  490.         DoubleBuffer (&ms);
  491.     }
  492.     else if (wpa8)
  493.     {
  494.         while (rects != NULL)
  495.         {
  496.             WritePixelArray8 (video_window->RPort, rects->x, rects->y,
  497.                           rects->x + rects->width - 1,
  498.                           rects->y + rects->height - 1,
  499.                           vid_buffer, &temprp);
  500.             rects = rects->pnext;
  501.         }
  502.     }
  503.     else
  504.     {
  505.         while (rects != NULL)
  506.         {
  507.             ChunkyFastest ((UBYTE *)next_sbuf, (UBYTE *)vid_buffer, rects->x, rects->y,
  508.                                         rects->x + rects->width, rects->y + rects->height, ms.bpr);
  509.             rects = rects->pnext;
  510.         }
  511.  
  512.         if (ms.numbuffers == 2)
  513.         {
  514.             if (next_sbuf == ms.screen)
  515.                 next_sbuf = ms.screenb;
  516.             else
  517.                 next_sbuf = ms.screen;
  518.         }
  519.         else if (ms.numbuffers == 3)
  520.         {
  521.             if (next_sbuf == ms.screen)
  522.                 next_sbuf = ms.screenb;
  523.             else if (next_sbuf == ms.screenb)
  524.                 next_sbuf = ms.screenc;
  525.             else
  526.                 next_sbuf = ms.screen;
  527.         }
  528.         DoubleBuffer (&ms);
  529.     }
  530. }
  531.  
  532. /**********************************************************************/
  533. /*
  534. ================
  535. D_BeginDirectRect
  536. ================
  537. */
  538.  
  539. void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
  540. {
  541. }
  542.  
  543. /**********************************************************************/
  544. /*
  545. ================
  546. D_EndDirectRect
  547. ================
  548. */
  549. void D_EndDirectRect (int x, int y, int width, int height)
  550. {
  551. }
  552.  
  553. /**********************************************************************/
  554. void Sys_SendKeyEvents(void)
  555. {
  556.   UWORD code;
  557.     ULONG class;
  558.     WORD mousex, mousey;
  559.   struct IntuiMessage *msg;
  560.   static int xlate[0x68] = {
  561.     '`', '1', '2', '3', '4', '5', '6', '7',
  562.     '8', '9', '0', '-', '=', '\\', 0, '0',
  563.     'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
  564.     'o', 'p', K_F11, K_F12, 0, '0', '2', '3',
  565.     'a', 's', 'd', 'f', 'g', 'h', 'j', 'k',
  566.     'l', ';', '\'', K_ENTER, 0, '4', '5', '6',
  567.     K_SHIFT, 'z', 'x', 'c', 'v', 'b', 'n', 'm',
  568.     ',', '.', '/', 0, '.', '7', '8', '9',
  569.     K_SPACE, K_BACKSPACE, K_TAB, K_ENTER, K_ENTER, K_ESCAPE, K_F11,
  570.     0, 0, 0, '-', 0, K_UPARROW, K_DOWNARROW, K_RIGHTARROW, K_LEFTARROW,
  571.     K_F1, K_F2, K_F3, K_F4, K_F5, K_F6, K_F7, K_F8,
  572.     K_F9, K_F10, '(', ')', '/', '*', '=', K_PAUSE,
  573.     K_SHIFT, K_SHIFT, 0, K_CTRL, K_ALT, K_ALT, 0, K_CTRL
  574.   };
  575.  
  576.     if (video_window !=NULL )
  577.     {
  578.         while ((msg = (struct IntuiMessage *)GetMsg (video_window->UserPort)) != NULL)
  579.         {
  580.       class = msg->Class;
  581.       code = msg->Code;
  582.       mousex = msg->MouseX;
  583.       mousey = msg->MouseY;
  584.       ReplyMsg ((struct Message *)msg);
  585.       switch (class)
  586.             {
  587.         case IDCMP_RAWKEY:
  588.           if ((code & 0x80) != 0)
  589.                     {
  590.             code &= ~0x80;
  591.             if (code < 0x68)
  592.               Key_Event (xlate[code], false);
  593.           }
  594.                     else 
  595.                     {
  596.             if (code < 0x68)
  597.               Key_Event (xlate[code], true);
  598.           }
  599.           break;
  600.         case IDCMP_MOUSEBUTTONS:
  601.                     switch (code)
  602.                     {
  603.                       case IECODE_LBUTTON:
  604.                         Key_Event (K_MOUSE1, true);
  605.                             break;
  606.                     case IECODE_LBUTTON + IECODE_UP_PREFIX:
  607.                       Key_Event (K_MOUSE1, false);
  608.                       break;
  609.                     case IECODE_MBUTTON:
  610.                       Key_Event (K_MOUSE2, true);
  611.                       break;
  612.                     case IECODE_MBUTTON + IECODE_UP_PREFIX:
  613.                       Key_Event (K_MOUSE2, false);
  614.                       break;
  615.                     case IECODE_RBUTTON:
  616.                       Key_Event (K_MOUSE3, true);
  617.                       break;
  618.                     case IECODE_RBUTTON + IECODE_UP_PREFIX:
  619.                       Key_Event (K_MOUSE3, false);
  620.                       break;
  621.                         default:
  622.                             break;
  623.                     }
  624.         case IDCMP_MOUSEMOVE:                                    // Handled in in_amiga.c
  625.           last_mouse[0] = mousex;
  626.           last_mouse[1] = mousey;
  627.                     mousemove = true;
  628.           break;
  629.         default:
  630.           break;
  631.       }
  632.     }
  633.   }
  634. }
  635.  
  636. /**********************************************************************/
  637.